package GUI;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

public class buysellButton extends JPanel{
	private Controller control;
	public buysellButton (Controller c)
	{
		this.control = c;
		JRadioButton buyButton = new JRadioButton("Buy");
		buyButton.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				control.setBuySell("Buy");
			}
		});
		JRadioButton sellButton = new JRadioButton("Sell");
		sellButton.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				control.setBuySell("Sell");
			}
		});
		ButtonGroup group = new ButtonGroup();
		group.add(buyButton);
		group.add(sellButton);
		
		JPanel radioPanel = new JPanel(new FlowLayout(1,0,-1));
		radioPanel.add(buyButton);
		radioPanel.add(sellButton);
		add(radioPanel, BorderLayout.LINE_START);
	}
	
}
